class Lodash {
    constructor() {

    }
    difference() {
        if (!arguments.length) return []
        const resultArray = []
        const targetArray = arguments[0]
        const filterArray = Array.prototype.slice.call(arguments, 1)
        const map = new Map()
        for (let i = 0; i < filterArray.length; i++) {
            if (Array.isArray(filterArray[i])) {
                for (let j = 0; j < filterArray[i].length; j++) {
                    if (!map.has(filterArray[i][j])) {
                        map.set(filterArray[i][j], true)
                    }
                }
            }
        }
        for (let i = 0; i < targetArray.length; i++) {
            if (!map.has(targetArray[i])) {
                resultArray.push(targetArray[i])
            }

        }
        return resultArray
    }
}

const l = new Lodash()



console.log(l.difference([3, 2, 1], [4, 2],[2,1]));
// => [3, 1]


